/**
 * $Revision: 1.0 $
 * $Author: Geln Yang $
 * $Date: May 19, 2010 10:56:08 PM $
 *
 * Author: Geln Yang
 * Date  : May 19, 2010 10:56:08 PM
 *
 */
package com.gooex.web.action.common;

import java.util.List;

import org.c4j.string.StringTools;

import com.gooex.domain.common.Region;
import com.gooex.service.common.IRegionManager;
import com.gooex.web.action.AjaxableAction;


/**
 * @author Geln Yang
 * @version 1.0
 */
public class GetRegionAction extends AjaxableAction {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private IRegionManager regionManager;

	private Region region;

	private String id;

	private List<Region> regions;

	public String getRegionById() throws Exception {
		region = regionManager.getRegion(id);
		return SUCCESS;
	}

	public String getChildren() throws Exception {
		if (StringTools.isNotBlankOrNull(id)) {
			region = regionManager.getRegion(id);
			if (region != null)
				regions = region.getChildren();
		}
		return SUCCESS;
	}

	public String getTopRegions() throws Exception {
		regions = regionManager.getTopRegions();
		return SUCCESS;
	}

	public Region getRegion() {
		return region;
	}

	public void setRegion(Region region) {
		this.region = region;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public List<Region> getRegions() {
		return regions;
	}

	public void setRegions(List<Region> regions) {
		this.regions = regions;
	}

	public void setRegionManager(IRegionManager regionManager) {
		this.regionManager = regionManager;
	}
}
